# encoding: utf-8
import sys
import pyttsx
import random
import time


void_id_array = ['com.apple.speech.synthesis.voice.Alex',
                 'com.apple.speech.synthesis.voice.anna',
                 'com.apple.speech.synthesis.voice.carmit',
                 'com.apple.speech.synthesis.voice.damayanti',
                 'com.apple.speech.synthesis.voice.ellen',
                 'com.apple.speech.synthesis.voice.ioana',
                 'com.apple.speech.synthesis.voice.joana',
                 'com.apple.speech.synthesis.voice.kanya',
                 'com.apple.speech.synthesis.voice.karen',
                 'com.apple.speech.synthesis.voice.kyoko',
                 'com.apple.speech.synthesis.voice.milena',
                 'com.apple.speech.synthesis.voice.moira',
                 'com.apple.speech.synthesis.voice.nora',
                 'com.apple.speech.synthesis.voice.samantha',
                 'com.apple.speech.synthesis.voice.sara',
                 'com.apple.speech.synthesis.voice.satu',
                 'com.apple.speech.synthesis.voice.sin-ji',
                 'com.apple.speech.synthesis.voice.tessa',
                 'com.apple.speech.synthesis.voice.ting-ting',
                 'com.apple.speech.synthesis.voice.veena',
                 'com.apple.speech.synthesis.voice.Victoria',
                 'com.apple.speech.synthesis.voice.yuna',
                 'com.apple.speech.synthesis.voice.zosia']


def play(content):
    engine.setProperty('voice', void_id_array[random.randint(0, len(void_id_array) - 1)])
    engine.say(content)


def test_play():
    count = 0
    # while count < len(void_id_array):
    #     random_voice_id = void_id_array[random.randint(0, len(void_id_array) - 1)]
    #     print random_voice_id
    #     engine.setProperty('voice', random_voice_id)
    #     voice_id_split = random_voice_id.split('.')
    #     play('I am ' + voice_id_split[len(voice_id_split) - 1])
    #     count += 1


engine = pyttsx.init()
play('score')
play('messi')
engine.runAndWait()
